package com.server.questionbank.snframe.util.MinIo;

import java.io.InputStream;
import java.util.List;

public interface MinIoBucket {
    public String getBucketName();

    // 删除当前Bucket
    public void deleteBucket() throws Exception;

    // 文件操作

    // 上传文件
    public void uploadFile(String objectName, InputStream inputStream, String contentType, long size) throws Exception;

    // 判断文件是否存在
    public boolean fileExists(String objectName) throws Exception;

    // 获取文件列表
    public List<String> listFiles(String objectName) throws Exception;

    // 下载文件
    public InputStream downloadFile(String objectName, long start, long end) throws Exception;
    public InputStream downloadFile(String objectName) throws Exception;

    // 获取文件大小
    public long getFileSize(String objectName) throws Exception;

    // 获取文件类型
    public String getFileType(String objectName) throws Exception;

    // 删除文件
    public void deleteFile(String objectName) throws Exception;

    // 复制文件
    public void copyFile(String sourcePath, String destPath) throws Exception;

    // 移动文件
    public void moveFile(String sourcePath, String destPath) throws Exception;

    // 获取文件名
    public static String getFileName(String objectPath) {
        int lastSlash = objectPath.lastIndexOf("/");
        return objectPath.substring(lastSlash + 1);
    }
}
